﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApplication1;

namespace znq
{
    public partial class Control : Form
    {
        Form1 main;

        public Control(Form1 m)
        {
            InitializeComponent();
            main = m;
            setAttribute();
        }

        //初始化属性
        private void setAttribute()
        {
            this.numericUpDown1.Value = main.startRow;
            this.numericUpDown2.Value = main.timeCol;
            this.numericUpDown3.Value = main.sCol;
            this.numericUpDown4.Value = main.fCol;
            this.numericUpDown5.Value = main.leftBar;
            this.numericUpDown6.Value = main.rightBar;
            this.numericUpDown7.Value = decimal.Parse(main.sRatio.ToString());
            this.numericUpDown8.Value = decimal.Parse(main.fRatio.ToString());
            this.numericUpDown9.Value = main.dePeriod;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            numericUpDown1.Value = 10;
            numericUpDown2.Value = 1;
            numericUpDown3.Value = 2;
            numericUpDown4.Value = 3;
            numericUpDown5.Value = 5;
            numericUpDown6.Value = 5;
            numericUpDown7.Value = 1;
            numericUpDown8.Value = 1;

            main.startRow = 10;
            main.timeCol = 1;
            main.sCol = 2;
            main.fCol = 3;
            main.leftBar = 5;
            main.rightBar = 5;
            main.sRatio = 1.00;
            main.fRatio = 1.00;
            main.dePeriod = 3;
            main.freshChart();
            this.Close();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            main.freshChart();
            this.Close();
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            main.startRow = int.Parse(numericUpDown1.Value.ToString());
        }

        private void numericUpDown2_ValueChanged(object sender, EventArgs e)
        {
            main.timeCol = int.Parse(numericUpDown2.Value.ToString());

        }

        private void numericUpDown3_ValueChanged(object sender, EventArgs e)
        {
            main.sCol = int.Parse(numericUpDown3.Value.ToString());

        }

        private void numericUpDown4_ValueChanged(object sender, EventArgs e)
        {
            main.fCol = int.Parse(numericUpDown4.Value.ToString());

        }

        private void numericUpDown5_ValueChanged(object sender, EventArgs e)
        {
            main.leftBar = int.Parse(numericUpDown5.Value.ToString());

        }

        private void numericUpDown6_ValueChanged(object sender, EventArgs e)
        {
            main.rightBar = int.Parse(numericUpDown6.Value.ToString());

        }

        private void numericUpDown7_ValueChanged(object sender, EventArgs e)
        {
            main.sRatio = double.Parse(numericUpDown7.Value.ToString());

        }

        private void numericUpDown8_ValueChanged(object sender, EventArgs e)
        {
            main.fRatio = double.Parse(numericUpDown8.Value.ToString());
        }

        private void numericUpDown9_ValueChanged(object sender, EventArgs e)
        {
            main.dePeriod = int.Parse(numericUpDown9.Value.ToString());
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }



    }
}
